package mornd.test3;

import lombok.Setter;
import lombok.ToString;
import org.springframework.beans.BeanWrapperImpl;

import java.util.Date;

/**
 * @author: mornd
 * @dateTime: 2023/5/7 - 22:55
 * Setter 方法赋值
 */
public class BeanWrapperDemo {
    public static void main(String[] args) {
        User user = new User();
        BeanWrapperImpl wrapper = new BeanWrapperImpl(user);
        wrapper.setPropertyValue("id", 1001);
        wrapper.setPropertyValue("name", "tom");
        wrapper.setPropertyValue("birthday", new Date());
        wrapper.setPropertyValue("age", 22);
        System.out.println(user);
    }

    @Setter
    @ToString
    static class User {
        private Integer id;
        private String name;
        private Date birthday;
        private int age;
    }
}
